package top.lidee.module.clientApi.twice.applet.order;

import java.util.Arrays;
import java.util.Map;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



import top.lidee.common.service.twice.applet.SmsSkuFullReductionService;
import top.lidee.framework.result.PageUtils;
import top.lidee.framework.result.ResponseResult;
import top.lidee.repository.model.twice.pojo.applet.SmsSkuFullReductionEntity;


/**
 * 商品满减信息
 *
 * @author zhangzhan
 * @email 52194440@qq.com
 * @date 2024-10-18 10:38:03
 */
@Api("商品满减信息")
@RestController
@RequestMapping("/clientApi/applet/smsskufullreduction")
public class SmsSkuFullReductionController {
    @Autowired
    private SmsSkuFullReductionService smsSkuFullReductionService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    @ApiOperation(value = "商品满减信息列表")
    public ResponseResult list(@RequestBody Map<String, Object> params){
        PageUtils page = smsSkuFullReductionService.queryPage(params);

        return ResponseResult.okResultPage("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping(value = "/info/{skuFullReductionId}",method = RequestMethod.GET)
    @ApiOperation(value = "商品满减信息信息")
    public ResponseResult info(@PathVariable("skuFullReductionId") Integer skuFullReductionId){
		SmsSkuFullReductionEntity smsSkuFullReduction = smsSkuFullReductionService.getById(skuFullReductionId);

        return ResponseResult.okResultPage("SmsSkuFullReduction", smsSkuFullReduction);
    }

    /**
     * 保存
     */
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ApiOperation(value = "商品满减信息保存")
    public ResponseResult save(@RequestBody SmsSkuFullReductionEntity smsSkuFullReduction){
		smsSkuFullReductionService.save(smsSkuFullReduction);

        return ResponseResult.ok();
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update",method = RequestMethod.PUT)
    @ApiOperation(value = "商品满减信息修改")
    public ResponseResult update(@RequestBody SmsSkuFullReductionEntity smsSkuFullReduction){
		smsSkuFullReductionService.updateById(smsSkuFullReduction);

        return ResponseResult.ok();
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    @ApiOperation(value = "商品满减信息删除")
    public ResponseResult delete(@RequestBody Integer[] skuFullReductionIds){
		smsSkuFullReductionService.removeByIds(Arrays.asList(skuFullReductionIds));

        return ResponseResult.ok();
    }

}
